<?php
if(isset($_POST['arid']))
{
	require("includes/basic.php");
	$rid=$_POST['arid'];
	$id= split(',',$rid);
	foreach($id as $a => $b)
	{
		$activater=mysql_query("update user_master set record_status='Y' where user_id=$b");
	}
}
if(isset($_POST['drid']))
{
	require("includes/basic.php");
	$rid=$_POST['drid'];
	$id= split(',',$rid);
	foreach($id as $a => $b)
	{
		$activater=mysql_query("update user_master set record_status='N' where user_id=$b");
	}
}
if(isset($_POST['s']))
{
	require("includes/basic.php");
	$class="evenrowbg";
$s=$_POST['s'];
if($userType=='O') {
$sql= "select * from user_master where customer_id=$customerid and (LOWER(first_name) like LOWER('$s%') or last_name like LOWER('$s%'))";
}
elseif($userType=='V')
{
$sql= "select * from user_master where customer_id=(select  vendor_created_by from vendor_master where vendor_id=$userId) and (LOWER(first_name) like LOWER('$s%') or last_name like LOWER('$s%'))";

}
}
else
{
if($userType=='O') {
$sql="select * from user_master where customer_id=$customerid";
}
elseif($userType=='V')
{
$sql="select * from user_master where customer_id=(select  vendor_created_by from vendor_master where vendor_id=$userId) and vendor_id=$userId";
}	

}
include('ps_pagination.php'); 
$pager = new PS_Pagination($conn, $sql, 8, 5, "param1=valu1&param2=value2");
	
	/*
	 * Enable debugging if you want o view query errors
	*/
	$pager->setDebug(true);
	
	/*
	 * The paginate() function returns a mysql result set
	 * or false if no rows are returned by the query
	*/
	$rs = $pager->paginate();
	if(!$rs) die(mysql_error());


	$sr=1;
$class="evenrowbg";


?>
<form name="frm">
	<table width='100%' cellpadding='1' cellspacing='0' class='list'>
	<tr>
		<!-- <th width='4%' style='white-space: nowrap;'>
			<div style='display:block;'>
				<span class="link linkdisabled">Sr no.</span>
			</div>
		</th> -->
        <th width='4%' style='white-space: nowrap;'>
			<div style='display:block;'>
				<span class="link linkdisabled">Open</span>
			</div>
		</th>
		<th width='4%' style='white-space: nowrap;'>
			<div style='display:block;'>
				<span class="link linkdisabled">Edit</span>
			</div>
		</th>
		<th width='20%' style='white-space: nowrap;'>
			<div style='display:block;'>
				<span class="link linkdisabled">Resource Name</span>
			</div>
		</th>
		<th width='20%' style='white-space: nowrap;'>
			<div style='display:block;'>
				<span class="link linkdisabled">Mobile</span>
			</div>
		</th>
		<th width='20%' style='white-space: nowrap;'>
			<div style='display:block;'>
				<span class="link linkdisabled">Username</span>
			</div>
		</th>
		<!--<th width='20%' style='white-space: nowrap;' align='center'>
			<span class="link linkdisabled">Password</span>
		</th>-->
		<th width='4%' style='white-space: nowrap;'>
			<span class="link linkdisabled">Status</span>
		</th>
		<th width='4%' class='select'>
			
<input type='checkbox' class='checkbox' name='allCheck' id='listSelectAll'>
		</th>
	</tr>
	<?php while($userr=mysql_fetch_array($rs))
	{
		$userid=$userr['user_id'];
		$fname=$userr['first_name'];
		$lname=$userr['last_name'];
		$Uname=$userr['user_name'];
		$pass=base64_decode($userr['user_password']);
		$status=$userr['record_status'];
		$mobile=$userr['mobile'];
		if($class=="evenrowbg")
		{
			$class="oddrowbg";
		}
		else
		{
			$class="evenrowbg";
		}
		echo "<tr class='$class'>";
		//echo "<td style='text-align:center;'>$sr</td>";
		echo "<td style='text-align:center;'><a href='open_resource.php?r=$userid'><img src='images/open.png'/></a></td>";

		echo "<td style='text-align:center;'>";
		if($userType=='O')
		{
		echo "<a href='edit-resource.php?rid=$userid'><img src='images/edit.png'/></a>";
		}
		elseif($userType=='V')
		{
		echo "<a href='edit-vendor-contact.php?vcid=$userid'><img src='images/edit.png'/></a>";
		}
		echo "</td>";
		echo "<td>".$fname." ".$lname."</td><td>".$mobile."</td><td>".$Uname."</td>";
		/*$pdoc=mysql_query("select * from project_doc where project_id=".$projectid);
		$noOfdocs=mysql_num_rows($pdoc);*/
		//echo "<td>$noOfdocs</td><td>";
		//$client=mysql_query("select c.* from client_master c, client_project cp where c.client_id=cp.client_id and cp.project_id=$projectid");
		/*if(mysql_num_rows($client)>0)
		{
			while($clientr=mysql_fetch_array($client))
			{
			extract($clientr);
			$clientname=$clientr['client_name'];
			echo $clientname."<br/>";
			}
		}
		echo "</td><td style='text-align:center;'>";*/		
		echo "<td style='text-align:center;'>";
		if($status=='Y')
		{
			echo "<img src='images/multi_activate.png' alt='Active' title='Active'>";
		}
		else
		{
			echo "<img src='images/multi_deactivate.png' alt='Disabled' title='Disabled'>";
		}
		echo "</td>";
		echo "<td style='text-align:center;'><input type='checkbox' value='$userid' id='custid' name='chkName'></td>";
		echo "</tr>";
		$sr++;
	}
	//echo Pages("tutorials",$perpage,"view-resources.php?");	

	?>
    
</table>
</form>

<?php

	//Display the full navigation in one go
	 echo "<br />\n";?>
	